<?php $this->pageTitle = str_replace('fieldset',__('field group'),$this->pageTitle);?>
<div class="eavFields index">
<?php 
			$addUrl = array('action'=>'add');
			if($useFieldset)
			{
				$addUrl['fieldset'] = $this->params['named']['fieldset'];
			}
			echo $html->link(sprintf(__('New %s', true),$displayName), $addUrl,array('class'=>'add_button')); 
			echo $html->link(__('Sort Order of fields'),array('action'=>"setOrders",@$this->params['named']['fieldset']),array('class'=>'add_button'));
			?>
<?php 
	$confirmMessage = "You are about to delete a field which might be associated with some listings or review, if you continue information related to this field will be deleted.";
	if($fieldModelAlias=='UserField')
	{
		$confirmMessage = 'Are you sure you want to delete this field.';
	}
	$paginator->options(array('url'=>$this->getPagingUrl()));
	
	$index->setData($fields, $fieldModelAlias);
	$showFields = ClassRegistry::getObject($fieldModelAlias)->getFields('group',"grid");
	
	$index->showFields($showFields);
	$index->sortableFields($showFields );
	
	$index->setAction('Edit', array('action'=>"edit",":$fieldModelAlias.id"));
	$index->setAction('Delete', array('action'=>"delete",":$fieldModelAlias.id"),$this->helpers,__($confirmMessage));
	if($useFieldset == true)
	{
		$index->addColumn('fieldset_id','createLinkableName');
	}
	
	$index->setPaginateSeparator(' ');
	echo $index->display();
	
	function createLinkableName($record)
	{	
		$html = ClassRegistry::getObject('view')->loaded['html'];
		$fieldModelAlias = ClassRegistry::getObject('view')->viewVars['fieldsetModelAlias'];
		return $html->link(__($record[$fieldModelAlias]['name']),array('action'=>"index",'fieldset' => $record[$fieldModelAlias]['id']));
	}
?>
</div>
<div class="actions">
	<ul>
		<li>
		
		</li>
	</ul>
</div>
<?php $html->addJUI()?>